package cn.yunhe.controller;

import cn.yunhe.entity.InStockRecord;
import cn.yunhe.service.InStockRecordService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 邓永凯
 */
@WebServlet("/after/InStockRecordServlet")
public class InStockRecordServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //调用service层的方法
        InStockRecordService inStockRecordService = new InStockRecordService();
        List<InStockRecord> inStockRecord = inStockRecordService.getAllInStockRecord();
        //保存到reques域里面
        request.setAttribute("inStockRecord",inStockRecord);
        //转发
        request.getRequestDispatcher("instock-record-show.jsp").forward(request,response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
